﻿@using Covenant.Models.Grunts
@model IEnumerable<GruntTask>
@{
    Layout = "_GruntTaskLayout";
    ViewData["Title"] = "GruntTasks";
    IEnumerable<ReferenceSourceLibrary> ReferenceSourceLibraries = ViewBag.ReferenceSourceLibraries;
    IEnumerable<ReferenceAssembly> ReferenceAssemblies = ViewBag.ReferenceAssemblies;
    IEnumerable<EmbeddedResource> EmbeddedResources = ViewBag.EmbeddedResources;
}
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3">
    <h1 class="h2">Tasks</h1>
</div>

<ul class="nav nav-tabs mb-3" id="grunt-tab" role="tablist">
    <li class="nav-item">
        <a class="nav-link active" id="tasks-tab" data-toggle="tab" href="#tasks" role="tab" aria-controls="tasks" aria-selected="true">Tasks</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="libraries-tab" data-toggle="tab" href="#libraries" role="tab" aria-controls="libraries" aria-selected="false">Reference Source Libraries</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="assemblies-tab" data-toggle="tab" href="#assemblies" role="tab" aria-controls="assemblies" aria-selected="false">Reference Assemblies</a>
    </li>
    <li class="nav-item">
        <a class="nav-link" id="resources-tab" data-toggle="tab" href="#resources" role="tab" aria-controls="resources" aria-selected="false">Embedded Resources</a>
    </li>
</ul>

<div class="tab-content" id="grunt-tab-content">
    <div class="tab-pane fade" id="tasks" role="tabpanel" aria-labelledby="tasks-tab">
        @{
            await Html.RenderPartialAsync("_GruntTaskTable", Model);
        }
    </div>
    <div class="tab-pane fade" id="libraries" role="tabpanel" aria-labelledby="libraries-tab">
        @{
            await Html.RenderPartialAsync("../ReferenceSourceLibrary/_ReferenceSourceLibraryTable", ReferenceSourceLibraries);
        }
    </div>
    <div class="tab-pane fade" id="assemblies" role="tabpanel" aria-labelledby="assemblies-tab">
        @{
            await Html.RenderPartialAsync("../ReferenceAssembly/_ReferenceAssemblyTable", ReferenceAssemblies);
        }
    </div>
    <div class="tab-pane fade" id="resources" role="tabpanel" aria-labelledby="resources-tab">
        @{
            await Html.RenderPartialAsync("../EmbeddedResource/_EmbeddedResourceTable", EmbeddedResources);
        }
    </div>
</div>

@section Scripts {
<script type="text/javascript">$(document).ready(function () {
        $('#task-table').DataTable({
            "pageLength": 50,
            "info": false
        });
        $('#library-table').DataTable({
            "pageLength": 50,
            "info": false
        });
        $('#assembly-table').DataTable({
            "pageLength": 50,
            "info": false
        });
        $('#resource-table').DataTable({
            "pageLength": 50,
            "info": false
        });
        $("#tasks-tab").tab('show');
    });</script>
}